package com.ysg.widget.dialog;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.ysg.R;
import com.ysg.base.BaseDialog;
import com.ysg.utils.YStringUtil;

/**
 * 亲密度礼物
 */
public class IntimacyGiftDialog extends BaseDialog {
    public interface OnIntimacyGiftListener{
        void onGiftClick();
    }
    private OnIntimacyGiftListener listener;
    public void setOnIntimacyGiftListener(OnIntimacyGiftListener listener){
        this.listener = listener;
    }

    private String intimacyValue;
    public IntimacyGiftDialog(Context context, String intimacyValue) {
        super(context);
        this.intimacyValue = intimacyValue;
    }

    private View viewGift;
    private TextView tvContent, tvText;

    @Override
    public int getLayoutId() {
        return R.layout.dialog_intimacy_gift;
    }

    public void initView() {
        tvContent = findViewById(R.id.tvContent);
        tvText = findViewById(R.id.tvText);
        viewGift = findViewById(R.id.viewGift);
    }


    @Override
    public void initData() {
        if (YStringUtil.isNotEmpty(intimacyValue)){
            String content = String.format(getContext().getString(R.string.dialog_intimacy_content), intimacyValue);
            tvContent.setText(content);
        }
    }

    @Override
    public void initListener() {
        viewGift.setOnClickListener((v)->{
            dismiss();
            if (listener != null){
                listener.onGiftClick();
            }
        });
        tvText.setOnClickListener((v)->{
            dismiss();
        });
    }


}
